﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartyOpenMore.aspx.cs" Inherits="ZHDJ.Web.Portal.PartyOpenMore" MasterPageFile="~/PortalParts/Portal.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Resource/themes/default/css/jqtree.css" rel="stylesheet" />
    <script src="../Resource/js/default/jquery.min.1.12.js"></script>
    <script src="../Resource/js/jquery/tree.jquery.js"></script>
    <script src="../Resource/js/default/jquery.tmpl.min.js"></script>
    <script src="../Resource/js/knockout/knockout-3.4.0.js"></script>
    <script src="../Resource/js/jquery/jquery.pagination.js"></script>
    <script type="text/javascript">
        var pageSize = 15, isBind = false;
        var BindTreeClick = function () {
            $('#tree1').bind(
                'tree.click',
                function (event) {
                    var node = event.node;
                    $("#ctl00_ContentPlaceHolder1_hdBranchID").val(node.id);
                    initPage();
                }
            );
        }
        var treePara = {
            closedIcon: $('<img class="fa " src="../../Resource/themes/default/images/Default/triangle1.gif" />'),
            openedIcon: $('<img class="fa " src="../../Resource/themes/default/images/Default/triangle3.gif" />'),
            selectable: true,
            autoEscape: false,
            autoOpen: 0
        };
        var tabf = function () {
            $(".listtab").each(function (i, n) {
                $tab = $(n);
                var $content = $(n).parent().find(".listtabcontent");
                var $tab_a = $("a[tab]", n);
                $tab_a.each(function (j, m) {
                    var showId = $(m).attr("tab");
                    $(m).hover(function () {
                        $content.hide();
                        $tab_a.removeClass('lovetab');
                        $tab_a.addClass('lovetab2');
                        $(m).addClass("lovetab");
                        $content.eq(showId).show();
                    });
                });
            });
        }
        var pagerCallback = {
            PartyAffairs: function (pageIndex, jq) {
                ViewModel.loadPartyData(pageIndex);
                if (!isBind) {
                    ko.applyBindings(ViewModel);
                    isBind = true;
                }
            },
            Villageffairs: function (pageIndex, jq) {
                ViewModel.loadVillageData(pageIndex);
                if (!isBind) {
                    ko.applyBindings(ViewModel);
                    isBind = true;
                }
            },
            Finance: function (pageIndex, jq) {
                ViewModel.loadFinanceData(pageIndex);
                if (!isBind) {
                    ko.applyBindings(ViewModel);
                    isBind = true;
                }
            },
            AgriculturalPolicy: function (pageIndex, jq) {
                ViewModel.loadAgriculturalPolicyData(pageIndex);
            if (!isBind) {
                ko.applyBindings(ViewModel);
                isBind = true;
            }
            },
            PartyRemittance: function (pageIndex, jq) {
                ViewModel.loadPartyRemittanceData(pageIndex);
                if (!isBind) {
                    ko.applyBindings(ViewModel);
                    isBind = true;
                }
            },
            FirstSecretary: function (pageIndex, jq) {
                ViewModel.loadFirstSecretaryData(pageIndex);
                if (!isBind) {
                    ko.applyBindings(ViewModel);
                    isBind = true;
                }
            }
        };
        var paginationPara = {
            num_edge_entries: 1, //边缘页数
            num_display_entries: 4, //主体页数
            callback:  pagerCallback.PartyAffairs,
            items_per_page: pageSize, //每页显示1项
            prev_text: "上一页",
            next_text: "下一页",
            link_to: "javascript:void(0);"
        }



        var ViewModel = {
            partyData: ko.observableArray(),
            villageData: ko.observableArray(),
            financeData: ko.observableArray(),

            AgriculturalPolicyData: ko.observableArray(),
            PartyRemittanceData: ko.observableArray(),
            FirstSecretaryData: ko.observableArray(),

            loadPartyData: function (pageIndex) {
                $.get("PartyOpenMore.aspx", {
                    PageIndex: pageIndex, category: "PartyAffairs", PageSize: pageSize,
                    BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(),
                    r: (new Date()).getTime()
                },
                function (data) {

                    var ss = eval("(" + data + ")");
                    ViewModel.partyData(eval("(" + data + ")"));
                    $("#loading1").hide();
                });
            },
            loadVillageData: function (pageIndex) {
                $.get("PartyOpenMore.aspx", {
                    PageIndex: pageIndex, category: "VillageAffairs", PageSize: pageSize,
                    BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(),
                    r: (new Date()).getTime()
                },
                function (data) {
                   
                    var ss = eval("(" + data + ")");
                    ViewModel.villageData(eval("(" + data + ")"));
                    $("#loading2").hide();
                });
            },
            loadFinanceData: function (pageIndex) {
                $.get("PartyOpenMore.aspx", {
                    PageIndex: pageIndex, category: "Finance", PageSize: pageSize,
                    BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(),
                    r: (new Date()).getTime()
                },
                function (data) {
                    var ss = eval("(" + data + ")");
                    ViewModel.financeData(eval("(" + data + ")"));
                    $("#loading3").hide();
                });
            },

            loadAgriculturalPolicyData: function (pageIndex) {
            $.get("PartyOpenMore.aspx", {
                PageIndex: pageIndex, category: "AgriculturalPolicy", PageSize: pageSize,
                BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(),
                r: (new Date()).getTime()
            },
            function (data) {
                var ss = eval("(" + data + ")");
                ViewModel.AgriculturalPolicyData(eval("(" + data + ")"));
                $("#loading4").hide();
            });
            },
            loadFirstSecretaryData: function (pageIndex) {
                $.get("PartyOpenMore.aspx", {
                    PageIndex: pageIndex, category: "FirstSecretary", PageSize: pageSize,
                    BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(),
                    r: (new Date()).getTime()
                },
                function (data) {
                    var ss = eval("(" + data + ")");
                    ViewModel.FirstSecretaryData(eval("(" + data + ")"));
                    $("#loading6").hide();
                });
            },
            loadPartyRemittanceData: function (pageIndex) {
            $.get("PartyOpenMore.aspx", {
                PageIndex: pageIndex, category: "PartyRemittance", PageSize: pageSize,
                BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(),
                r: (new Date()).getTime()
            },
            function (data) {
                var ss = eval("(" + data + ")");
                ViewModel.PartyRemittanceData(eval("(" + data + ")"));
                $("#loading5").hide();
            });
        }
        }

        function initPage() {
            $(".lilists").remove();
            $(".trnonedata_p").hide();
            $(".loading_p").show();
            $.get("PartyOpenMore.aspx", { DataCount: 1, category: 'PartyAffairs', BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(), r: (new Date()).getTime() },
                function(data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#loading1").hide();
                        $("#trnonedata1").show();
                       
                    }
                    paginationPara.callback = pagerCallback.PartyAffairs;
                    $("#paginationParty").pagination(totalCount, paginationPara);
                });
            $.get("PartyOpenMore.aspx", { DataCount: 1, category: 'VillageAffairs', BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(), r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#loading2").hide();
                        $("#trnonedata2").show();
                    }
                    paginationPara.callback = pagerCallback.Villageffairs;
                    $("#paginationVillage").pagination(totalCount, paginationPara);
                });
            $.get("PartyOpenMore.aspx", { DataCount: 1, category: 'Finance', BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(), r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#loading3").hide();
                        $("#trnonedata3").show();
                    }
                    paginationPara.callback = pagerCallback.Finance;
                    $("#paginationFinance").pagination(totalCount, paginationPara);
                });
            $.get("PartyOpenMore.aspx", { DataCount: 1, category: 'AgriculturalPolicy', BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(), r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#loading4").hide();
                        $("#trnonedata4").show();
                    }
                    paginationPara.callback = pagerCallback.AgriculturalPolicy;
                    $("#paginationAgriculturalPolicy").pagination(totalCount, paginationPara);
                });
            $.get("PartyOpenMore.aspx", { DataCount: 1, category: 'FirstSecretary', BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(), r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#loading6").hide();
                        $("#trnonedata6").show();
                    }
                    paginationPara.callback = pagerCallback.FirstSecretary;
                    $("#paginationFirstSecretary").pagination(totalCount, paginationPara);
                });
            $.get("PartyOpenMore.aspx", { DataCount: 1, category: 'PartyRemittance', BranchID: $("#ctl00_ContentPlaceHolder1_hdBranchID").val(), r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#loading5").hide();
                        $("#trnonedata5").show();
                    }
                    paginationPara.callback = pagerCallback.PartyRemittance;
                    $("#paginationPartyRemittance").pagination(totalCount, paginationPara);
                });
        }

        

        $(function () {
            $('#tree1').tree(treePara);
            BindTreeClick();
            tabf();
            initPage();
        });

    </script>
    <script id="myTemplate" type="text/x-jquery-tmpl">
        <li class="lilists"><span>${CreateTime2}</span><a href="../ArticleDetailContent.aspx?id=${ID}" target="_blank" title="${Title}">${Title2}</a>
        </li>
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="hdBranchID" runat="server" Value="D658070EC3BF425BA8417745FDCBFCB0" />
    <asp:HiddenField ID="hfTotalCount" runat="server" Value="10" />
    <asp:HiddenField ID="hfModule" runat="server" />
    <div class="more_p clear-fix">
        <div class="mp_left">
            <div class="gypt">
                <div class="s_content_t">
                    <span class="s_content_t_i">三务公开</span>
                </div>
                <div class="s_content_border s_content_k menu_content_k list-group " style="height: 612px">
                    <div style="overflow-x: auto; height: 612px">
                        <div id="tree1" data-url="other/BranchNavigation.aspx?Json=1"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="mp_right ">
            <div class="s_content_k s_content_border s_content_k ">
                <div class="more_sy_right" style="min-height: 600px">
                    <div class="listtab  s_content_margin clearfix" style="margin-bottom: 3px;">
                        <div>
                            <a class="lovetab" tab="0" style="width: 100px; text-align: center"><span>党务</span></a>
                            <a class="lovetab2" tab="1" style="width: 100px; text-align: center"><span>政务(村务)</span></a>
                            <a class="lovetab2" tab="2" style="width: 100px; text-align: center"><span>财务</span></a>
                            <a class="lovetab2" tab="3" style="width: 100px; text-align: center"><span>涉农惠农政策</span></a>
                            <a class="lovetab2" tab="4" style="width: 100px; text-align: center"><span>阳光村务现场</span></a>
 <%--                           <a class="lovetab2" tab="5" style="width: 100px; text-align: center"><span>第一书记</span></a>--%>
                        </div>
                    </div>
                    <div class="part_dll">
                        <div class="listtabcontent">
                            <div class="ny_box">
                                <ul class="news_lb">
                                    <!-- ko template: { name: 'myTemplate', foreach: partyData} -->
                                    <!-- /ko -->
                                    <li id="loading1" class="loading_p" style="text-align: center; ">数据加载中</li>
                                    <li id="trnonedata1" class="trnonedata_p" style="text-align: center; display: none">此栏目暂无信息</li>
                                </ul>
                            </div>
                            <div class="pagination">
                                <div id="paginationParty" class="paginationC">
                                </div>
                            </div>
                        </div>
                        <div class="listtabcontent" style="display: none">
                            <div class="ny_box">
                                <ul class="news_lb">
                                    <!-- ko template: { name: 'myTemplate', foreach: villageData} -->
                                    <!-- /ko -->
                                    <li id="loading2" class="loading_p" style="text-align: center;">数据加载中</li>
                                    <li id="trnonedata2" class="trnonedata_p" style="text-align: center; display: none">此栏目暂无信息</li>
                                </ul>

                            </div>
                            <div class="pagination">
                                <div id="paginationVillage" class="paginationC">
                                </div>
                            </div>

                        </div>
                        <div class="listtabcontent" style="display: none">
                            <div class="ny_box">
                                <ul class="news_lb">
                                    <!-- ko template: { name: 'myTemplate', foreach: financeData} -->
                                    <!-- /ko -->
                                    <li id="loading3" class="loading_p" style="text-align: center;">数据加载中</li>
                                    <li id="trnonedata3" class="trnonedata_p" style="text-align: center; display: none">此栏目暂无信息</li>
                                </ul>
                            </div>
                            <div class="pagination">
                                <div id="paginationFinance" class="paginationC">
                                </div>
                            </div>

                        </div>
                        <div class="listtabcontent" style="display: none">
                            <div class="ny_box">
                                <ul class="news_lb">
                                    <!-- ko template: { name: 'myTemplate', foreach: AgriculturalPolicyData} -->
                                    <!-- /ko -->
                                    <li id="loading4" class="loading_p" style="text-align: center;">数据加载中</li>
                                    <li id="trnonedata4" class="trnonedata_p" style="text-align: center; display: none">此栏目暂无信息</li>
                                </ul>
                            </div>
                            <div class="pagination">
                                <div id="paginationAgriculturalPolicy" class="paginationC">
                                </div>
                            </div>

                        </div>
                        <div class="listtabcontent" style="display: none">
                            <div class="ny_box">
                                <ul class="news_lb">
                                    <!-- ko template: { name: 'myTemplate', foreach: PartyRemittanceData} -->
                                    <!-- /ko -->
                                    <li id="loading5" class="loading_p" style="text-align: center;">数据加载中</li>
                                    <li id="trnonedata5" class="trnonedata_p" style="text-align: center; display: none">此栏目暂无信息</li>
                                </ul>
                            </div>
                            <div class="pagination">
                                <div id="paginationPartyRemittance" class="paginationC">
                                </div>
                            </div>

                        </div>
<%--                        <div class="listtabcontent" style="display: none">
                            <div class="ny_box">
                                <ul class="news_lb">
                                    <!-- ko template: { name: 'myTemplate', foreach: FirstSecretaryData} -->
                                    <!-- /ko -->
                                    <li id="loading6" class="loading_p" style="text-align: center;">数据加载中</li>
                                    <li id="trnonedata6" class="trnonedata_p" style="text-align: center; display: none">此栏目暂无信息</li>
                                </ul>
                            </div>
                            <div class="pagination">
                                <div id="paginationFirstSecretary" class="paginationC">
                                </div>
                            </div>

                        </div>--%>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </div>
</asp:Content>
